package com.mall.product.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @author: 谢君臣
 * @Date: 2022/8/1-20:19
 * @version: 1.0
 * @function: redisson 来做分布式锁
 */
@Configuration
public class RedissonConfig {

    @Bean
    RedissonClient redissonClient() throws IOException{
        Config config = new Config();
        config.useSingleServer().setAddress("redis://192.168.133.100:6379");
        RedissonClient client = Redisson.create(config);
        return client;
    }

}
